<template>
  <div class="product-banner-4">
    <div class="container f f-col f-ac">
      <div v-slide-plus class="banner_title_en">
        <img src="@/assets/min_logo.png" />
        <span>RECOMMENDED PRODUCTS & SERVICES</span>
      </div>
      <Title
        v-slide-up
        title="推荐产品服务"
        left="0"
        color="#0e0b31"
        size="52"
        bold="700"
        :line-height="80"
      />
      <div class="g g3 gap31 mt30">
        <div v-slide-plus v-for="(item, index) in dataList" :key="index" class="g-item">
          <img :src="publicSrc(item.image)" />
          <div class="g-item-bottom">
            <Title
              v-slide-up
              :title="item.name"
              left="0"
              color="#0e0b31"
              size="16"
              bold="700"
              line="1"
              :line-height="24"
            />
            <div class="f f-ac f-je">
              <span @click="handleDetail(item)"> 查看详情 </span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script setup lang="ts">
import { serviceList } from "@/api/product";
import { publicSrc } from "@/utils/common";
const router = useRouter();

const queryParams = reactive({
  pageNum: 1,
  pageSize: 3,
  status: 0, // 0显示 1隐藏
  top: 1, // 0不推荐 1推荐
});
const dataList = ref<any>([]); // 推荐产品服务列表

onMounted(() => {
  getList();
});

// 获取推荐产品服务列表
const getList = () => {
  serviceList(queryParams).then((res: any) => {
    if (res.code == 200) {
      dataList.value = res.rows;
    }
  });
};

// 查看详情
const handleDetail = (item: any) => {
  router.push({
    path: "/pc/product",
    query: {
      id: item.id,
    },
  });
};
</script>
<style lang="scss" scoped>
.product-banner-4 {
  width: 100%;
  background: linear-gradient(180deg, #fff 0%, #ebebeb 100%);
  padding-bottom: 100px;
  .container {
    height: 100%;
    .banner_title_en {
      display: flex;
      align-items: center;
      justify-content: center;
      height: 40px;
      border-radius: 39px;
      background: linear-gradient(90deg, #43cf7c 0%, #26ffc9 100%);
      font-size: 14px;
      font-weight: 700;
      color: #ffffff;
      padding: 0 20px;
      margin-top: 87px;
      img {
        width: 35px;
        height: 24px;
        object-fit: cover;
        margin-right: 8px;
      }
    }
    .g {
      width: 100%;
      .g-item {
        height: 375px;
        background-color: #fff;
        backdrop-filter: blur(28px);
        img {
          width: 100%;
          height: 291px;
          background: #c4c4c4;
        }
        &-bottom {
          width: 100%;
          height: 84px;
          background-color: #fff;
          padding: 18px 28px;
          box-sizing: border-box;
          span {
            color: #409eff;
            cursor: pointer;
          }
        }
      }
    }
  }
}
</style>
